#include "session_manage_tree_widget.h"



sessionManageTreeView::sessionManageTreeView(QWidget *parent)
{
    initView();
}

void sessionManageTreeView::initView()
{
    initMainWindow();
    initSessionTreeView();
}

void sessionManageTreeView::initMainWindow()
{
    this->setWindowTitle(tr("session manager"));
}

void sessionManageTreeView::initSessionTreeView()
{
    m_sessionTreeView = new CSessionTreeView ();
    m_seeionTreeModel = new CSessionTreeViewModel (this) ;

    CSessionTreeItem* root = m_seeionTreeModel->root();
    root->setData("parent");
    CSessionTreeItem* sub1 = new CSessionTreeItem(root);
    sub1->setData("sub1");

    CSessionTreeItem* sub2 = new CSessionTreeItem(root);
    sub2->setData("sub2");

    CSessionTreeItem* sub13 = new CSessionTreeItem(sub1);
    sub13->setData("sub13");
    sub13->setIsDir(false);
    sub1->addChild(sub13);

    root->addChild(sub1);
    root->addChild(sub2);
    m_sessionTreeView->setModel(m_seeionTreeModel);
    // 设置弹出的窗口
    m_sessionTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
    this->setWidget(m_sessionTreeView);

}
/**
 * @brief sessionManageTreeView::initTreeData
 *
 */
void sessionManageTreeView::initTreeData()
{

}




sessionManageTreeView::~sessionManageTreeView()
{
    SAFE_DELETE_ELE(m_seeionTreeModel);
    SAFE_DELETE_ELE(m_sessionTreeView);
    //SAFE_DELETE_ELE(m_mainWidget);
    //SAFE_DELETE_ELE(m_mainLayout);
}
